// 关注操作

import { likeFollowAPI } from '@/apis/doctor'

export const useFollow = (type = 'doc') => {
	const onFollow = async (item) => {
		uni.showLoading({
			title: '关注中....'
		})
		// 发送请求
		await likeFollowAPI(item.id, type)
		// 修改页面的关注状态
		item.likeFlag = item.likeFlag === 1 ? 0 : 1
		// 关闭loading
		uni.hideLoading()
	}
	return { onFollow }
}
